package com.gui.menu
{
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	
	public class GUIMenuTutorial extends MovieClip
	{
		public var closeBtn:SimpleButton;
		public var nextBtn:SimpleButton;
		public var previousBtn:SimpleButton;
		
		public function GUIMenuTutorial()
		{
			super();
			
			stop();
			addEventListener(MouseEvent.CLICK, onButtonsClick, false, 0, true);
		}
		
		protected function onButtonsClick(ev:MouseEvent):void
		{
			trace("onButtonsClick : " + ev.target + ", "+ ev.target.name );
			
			if ( !( ev.target is  SimpleButton )) return;
			
			switch(ev.target.name)
			{
				case "closeBtn":
				{
					destroy();
					break;
				}
					
				case "nextBtn":
				{
					if (this.currentFrame+1 > this.totalFrames ) return;

					this.gotoAndStop(this.currentFrame+1);
					break;
				}

				case "previousBtn":
				{
					if (this.currentFrame-1 <= 0 ) return;
					
					this.gotoAndStop(this.currentFrame-1);
					break;
				}

				default:
				{
					break;
				}
			}
		}

		protected function destroy():void
		{
			removeEventListener(MouseEvent.CLICK, onButtonsClick);
			parent.removeChild(this);
		}
	}
}